<?php
include("wechat.class.php");//引入微信类

$wechatObj = new Wechat();//实例化微信类

$conn = connect_to_db();

$wechatObj->setConn($conn);

$action = isset($_GET['action']) ? $_GET['action'] : '';

if($action == "fans")
{
	$wechatObj->getFansList();//创建菜单
}
elseif($action == 'menu')
{
	$wechatObj->creatMenu();//创建菜单
}
elseif($action == 'token')
{
	$token = $wechatObj->getAccessToken();
	echo $token;
}
elseif($action == 'miss')
{
	$wechatObj->updateMissAccounts();	
}
elseif($action == 'qr')
{
    $num = isset($_GET['num'])? $_GET['num']:1;
	$wechatObj->createQrcode($num);
}
elseif($action == 'nick')
{
    $openid = isset($_GET['openid']) ? mysql_real_escape_string($_GET['openid']) : '';
	$wechatObj->updateAccount($openid);	
}
else
{
	echo "heihei";
}
?>
